from selenium.webdriver.common.by import By


class LoginGroupElements:
    def administrator_login(self, driver, username, password):
        # 注意:使用一组元素时,find_elements(注意这个s不能少)返回的是一组元素,所以索引必须使用[0]
        driver.find_elements(by=By.CSS_SELECTOR, value='.el-input__inner')[0].clear()
        driver.find_elements(by=By.CSS_SELECTOR, value='.el-input__inner')[0].send_keys(username)
        driver.find_elements(by=By.CSS_SELECTOR, value='.el-input__inner')[1].clear()
        driver.find_elements(by=By.CSS_SELECTOR, value='.el-input__inner')[1].send_keys(password)
        driver.find_element(by=By.CSS_SELECTOR, value=".el-button").click()